package feign.ethan.springCloud.serviceImpl;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author Ethan
 */
@Component("producerService")
public class ProducerService {

    @Resource
    RocketMQTemplate rocketMQTemplate;

    /**
     * 发送简单消息
     */
    public void sendMessage(){
        for(int i=0;i<1000;i++){
            rocketMQTemplate.convertAndSend("springBoot-rocketmq","rocketmq大爷，你好！"+i);
        }
    }

}
